package homework;

import java.sql.*;

public class Test {
    public static void main(String[] args) throws SQLException {
        //获得连接
        Connection con = DBUtils.getConnection();
        //获取语句执行
        String sql = "select * from employee where name = ? and gender = ?";
        PreparedStatement ps = con.prepareStatement(sql);
        ps.setString(1,"张三");
        ps.setString(2,"男");
        ResultSet resultSet = ps.executeQuery();
        while(resultSet.next()){
            int id = resultSet.getInt("id");
            String name = resultSet.getString("name");
            String gender = resultSet.getString("gender");
            double salary = resultSet.getDouble("salary");
            double bouns = resultSet.getDouble("bouns");
            Date join_date = resultSet.getDate("join_date");
            System.out.println(id + " " + name + " " + gender + " " + salary + " " + bouns + " " + join_date);
        DBUtils.close(con,ps,resultSet);
        }
    }
}
